﻿#include <iostream>
#include<math.h>

using namespace std;

int main()
{
    string s;
    cin >> s;
    int s_length = s.length();
    int result = 0;
    for (int i = 0; i < s_length; i++) {
        if (s[i] == '1') {
            result += pow(2, s_length - i - 1);
        }
    }
    cout << result;
}